<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="com.blockchain.console.service.content.entity.QuestionRecord"%>
<%@page import="com.blockchain.console.servlets.content.cjwt.QuestionList"%>
<%@page import="com.blockchain.console.servlets.content.cjwt.UpdateQuestion"%>
<%@page import="java.net.DatagramPacket"%>
<%@page import="com.blockchain.variables.FileType"%>
<%@page import="com.blockchain.console.servlets.upload.Upload"%>
<%@page import="com.blockchain.common.enums.QuestionType"%>
<html >
<head>
<%@include file="/WEB-INF/include/meta.jsp"%>
<%@include file="/WEB-INF/include/style.jsp"%>
</head>

<body>
<%
	CURRENT_CATEGORY = "XCGL";
	CURRENT_SUB_CATEGORY = "CJWT";
%>
<%
	QuestionRecord record = ObjectHelper.convert(request.getAttribute("record"), QuestionRecord.class);
%>
<%@include file="/WEB-INF/include/header.jsp"%>
<div class="w_main">
<div class="main clearfix">
    <div class="wrap">
        <div class="r_main">
            <div class="home_main">
            	<div class="box box1 mb15">
                	<div class="atil">
                    	<h3>帮助中心</h3>
                  </div>
                    <div class="con">
                    <div class="clear"></div>
                    <form name="example" method="post" action="<%=controller.getURI(request, UpdateQuestion.class)%>" class="form1" onsubmit="return onSubmit();">
                    <input type="hidden" name="id" value="<%=record.id%>"/>
                    <ul class="cell xc_jcxx ">
                    <li>
                        <div class="til"><span class="red">&nbsp;</span></div>
                        <div class="info orange">
                        <%StringHelper.filterHTML(out, controller.getPrompt(request, response, PromptLevel.ERROR));%>
                        </div>
                        <div class="clear"></div>
                    </li>
                    <li>
                        <div class="til"><span class="red">*</span>排序值：</div>
                        <div class="info">
                        	<input type="text" class="text yhgl_ser yw_w4 required isint max-length-10" name="questionIndex" value="<%=record.pxz%>"/>
                        	<p tip></p>
							<p errortip class="" style="display: none"></p>
                        </div>
                        <div class="clear"></div>
                    </li>
                    <li>
                        <div class="til"><span class="red">*</span>问题：</div>
                        <div class="info">
                        	<input type="text" class="text yhgl_ser yw_w4 required max-length-50" name="question" value="<%StringHelper.filterHTML(out, record.question);%>"/>
                        	<p tip>最大50个字符</p>
							<p errortip class="" style="display: none"></p>
                        </div>
                        <div class="clear"></div>
                    </li>
                    <li <% if(!isMultiLang){ %>style="display:none"<% } %>>
                        <div class="til"><span class="red">*</span>问题(英文)：</div>
                        <div class="info">
                        	<input type="text" class="text yhgl_ser yw_w4" name="questionEn" value="<%StringHelper.filterHTML(out, record.questionEn);%>"/>
							<p errortip class="" style="display: none"></p>
                        </div>
                        <div class="clear"></div>
                    </li>
                    <%-- <li <% if(!isMultiLang){ %>style="display:none"<% } %>>
                        <div class="til"><span class="red">*</span>问题(繁体)：</div>
                        <div class="info">
                        	<input type="text" class="text yhgl_ser yw_w4 max-length-50" name="questionTw" value="<%StringHelper.filterHTML(out, record.questionTw);%>"/>
                        	<p tip>最大50个字符</p>
							<p errortip class="" style="display: none"></p>
                        </div>
                        <div class="clear"></div>
                    </li> --%>
                    
                    <li>
                        <div class="til"><span class="red">*</span>类型：</div>
                        <div class="info orange">
                        	<select name="qType" class="yhgl_sel">
                                <%for (QuestionType s : QuestionType.values()) {%>
								<option value="<%=s.name()%>" <%if (s.name().equals(record.qt.name())) {%> selected="selected" <%}%>><%=s.getName()%></option>
								<%}%>
                            </select>
                        	 <p tip></p>
							<p errortip class="" style="display: none"></p>
                        </div>
                        <div class="clear"></div>
                    </li>

                    <li>
						<div class="til"><span class="red">*</span>发布时间：</div>
						<div class="info">
							<input type="text" name="createTime" readonly="readonly" id="datepicker1" class="yhgl_ser date required" value="<%=DateParser.format(record.tjsj)%>" />
						<div class="clear"></div>
							<p tip></p>
							<p errortip class="" style="display: none"></p>
						</div>
						<div class="clear"></div>
					</li>
                    <li>
                        <div class="til"><span class="red">*</span>回答内容：</div>
                        <div class="info">
	                        <textarea class="ta_content" name="hd" cols="100" rows="8" style="width:700px;height:500px;visibility:hidden;"><%StringHelper.format(out, record.hd,fileStore);%></textarea>
	                        <p id="errorContent">&nbsp;</p>
                        </div>
                        <div class="clear"></div>
                    </li>
                    <li <% if(!isMultiLang){ %>style="display:none"<% } %>>
                        <div class="til"><span class="red">*</span>回答内容(英文)：</div>
                        <div class="info">
	                        <textarea class="ta_content" name="hdEn" cols="100" rows="8" style="width:700px;height:500px;visibility:hidden;"><%StringHelper.format(out, record.hdEn,fileStore);%></textarea>
	                        <p id="errorContentEn">&nbsp;</p>
                        </div>
                        <div class="clear"></div>
                    </li>
                    <%-- <li <% if(!isMultiLang){ %>style="display:none"<% } %>>
                        <div class="til"><span class="red">*</span>回答内容(繁体)：</div>
                        <div class="info">
	                        <textarea class="ta_content" name="hdTw" cols="100" rows="8" style="width:700px;height:500px;visibility:hidden;"><%StringHelper.format(out, record.hdTw,fileStore);%></textarea>
	                        <p id="errorContentTw">&nbsp;</p>
                        </div>
                        <div class="clear"></div>
                    </li> --%>
                    
               		</ul>
                    <div class="tc w220 pt20">
                    	<input type="submit" class="btn4 mr30 sumbitForme" style="cursor: pointer;" fromname="form1" value="确认发布" />
                    	<a href="<%=controller.getURI(request, QuestionList.class) %>" class="btn4">返回</a>
                    </div>
                	<div class="clear"></div>
                    </form>
                    <div class="clear"></div>                    
                  </div>
                </div>
              <div class="box2 clearfix"></div>
            </div>
        </div>   
    </div>
    <%@include file="/WEB-INF/include/left.jsp" %>
    </div>
    </div>
<%@include file="/WEB-INF/include/footer.jsp"%>
<%@include file="/WEB-INF/include/script.jsp"%>
<%@include file="/WEB-INF/include/kindeditor.jsp" %>
<%@include file="/WEB-INF/include/datepicker.jsp"%>
	<script type="text/javascript" src="<%=controller.getStaticPath(request)%>/js/jquery-ui-1.10.4/js/time.js"></script>
	<script>
		var contentOk = function() {
			$("#errorContent").removeClass("red");
			$("#errorContent").html("&nbsp;");
			<% if(isMultiLang) { %>
			$("#errorContentEn").removeClass("red");
			$("#errorContentEn").html("&nbsp;");
			/* $("#errorContentTw").removeClass("red");
			$("#errorContentTw").html("&nbsp;"); */
			<% } %>
		};
		var contentNotOk = function() {
			$("#errorContent").addClass("red");
			$("#errorContent").html("文章内容不能为空");	
			<% if(isMultiLang) { %>
			$("#errorContentEn").addClass("red");
			$("#errorContentEn").html("文章内容不能为空");	
			/* $("#errorContentTw").addClass("red");
			$("#errorContentTw").html("文章内容不能为空"); */
			<% } %>
		}
		var editor1;
		KindEditor.ready(function(K) {
			editor1 = K.create('.ta_content', {
				uploadJson : '<%=controller.getURI(request, Upload.class)%>?type=<%=FileType.ARTICLE_ATTACHMENT.ordinal()%>',
				allowFileManager : false,
				formatUploadUrl: false,
				afterBlur:function(){
					this.sync();
					if(this.count('text')=='')
					{
						contentNotOk();	
					}
					else
					{
						contentOk();
					}
				}
			});
			prettyPrint();
		});
		
		$(function() {
			$("#datepicker1").datepicker({inline: true});
		    $('#datepicker1').datepicker('option', {dateFormat:'yy-mm-dd'});
		});
		function onSubmit()
		{
			if(editor1.count('text')=='')
			{
				contentNotOk();
				return false;
			}
			else
			{
				contentOk();
				return true;
			}
		}
	</script>
	<script type="text/javascript" src="<%=controller.getStaticPath(request)%>/js/validation.js"></script>
</body>
</html>